<html><body>
<style>

body, h1, h2, h3, div, span, p, pre, a {
  margin: 0;
  padding: 0;
  border: 0;
  font-weight: inherit;
  font-style: inherit;
  font-size: 100%;
  font-family: inherit;
  vertical-align: baseline;
}

body {
  font-size: 13px;
  padding: 1em;
}

h1 {
  font-size: 26px;
  margin-bottom: 1em;
}

h2 {
  font-size: 24px;
  margin-bottom: 1em;
}

h3 {
  font-size: 20px;
  margin-bottom: 1em;
  margin-top: 1em;
}

pre, code {
  line-height: 1.5;
  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
}

pre {
  margin-top: 0.5em;
}

h1, h2, h3, p {
  font-family: Arial, sans serif;
}

h1, h2, h3 {
  border-bottom: solid #CCC 1px;
}

.toc_element {
  margin-top: 0.5em;
}

.firstline {
  margin-left: 2 em;
}

.method  {
  margin-top: 1em;
  border: solid 1px #CCC;
  padding: 1em;
  background: #EEE;
}

.details {
  font-weight: bold;
  font-size: 14px;
}

</style>

<h1><a href="androidpublisher_v3.html">Google Play Android Developer API</a> . <a href="androidpublisher_v3.purchases.html">purchases</a> . <a href="androidpublisher_v3.purchases.subscriptionsv2.html">subscriptionsv2</a></h1>
<h2>Instance Methods</h2>
<p class="toc_element">
  <code><a href="#cancel">cancel(packageName, token, body=None, x__xgafv=None)</a></code></p>
<p class="firstline">Cancel a subscription purchase for the user.</p>
<p class="toc_element">
  <code><a href="#close">close()</a></code></p>
<p class="firstline">Close httplib2 connections.</p>
<p class="toc_element">
  <code><a href="#get">get(packageName, token, x__xgafv=None)</a></code></p>
<p class="firstline">Get metadata about a subscription</p>
<p class="toc_element">
  <code><a href="#revoke">revoke(packageName, token, body=None, x__xgafv=None)</a></code></p>
<p class="firstline">Revoke a subscription purchase for the user.</p>
<h3>Method Details</h3>
<div class="method">
    <code class="details" id="cancel">cancel(packageName, token, body=None, x__xgafv=None)</code>
  <pre>Cancel a subscription purchase for the user.

Args:
  packageName: string, Required. The package of the application for which this subscription was purchased (for example, &#x27;com.some.thing&#x27;). (required)
  token: string, Required. The token provided to the user&#x27;s device when the subscription was purchased. (required)
  body: object, The request body.
    The object takes the form of:

{ # Request for the purchases.subscriptionsv2.cancel API.
  &quot;cancellationContext&quot;: { # Cancellation context of the purchases.subscriptionsv2.cancel API. # Required. Additional details around the subscription revocation.
    &quot;cancellationType&quot;: &quot;A String&quot;, # Required. The type of cancellation for the purchased subscription.
  },
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response for the purchases.subscriptionsv2.cancel API.
}</pre>
</div>

<div class="method">
    <code class="details" id="close">close()</code>
  <pre>Close httplib2 connections.</pre>
</div>

<div class="method">
    <code class="details" id="get">get(packageName, token, x__xgafv=None)</code>
  <pre>Get metadata about a subscription

Args:
  packageName: string, The package of the application for which this subscription was purchased (for example, &#x27;com.some.thing&#x27;). (required)
  token: string, Required. The token provided to the user&#x27;s device when the subscription was purchased. (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Indicates the status of a user&#x27;s subscription purchase.
  &quot;acknowledgementState&quot;: &quot;A String&quot;, # The acknowledgement state of the subscription.
  &quot;canceledStateContext&quot;: { # Information specific to a subscription in the SUBSCRIPTION_STATE_CANCELED or SUBSCRIPTION_STATE_EXPIRED state. # Additional context around canceled subscriptions. Only present if the subscription currently has subscription_state SUBSCRIPTION_STATE_CANCELED or SUBSCRIPTION_STATE_EXPIRED.
    &quot;developerInitiatedCancellation&quot;: { # Information specific to cancellations initiated by developers. # Subscription was canceled by the developer.
    },
    &quot;replacementCancellation&quot;: { # Information specific to cancellations caused by subscription replacement. # Subscription was replaced by a new subscription.
    },
    &quot;systemInitiatedCancellation&quot;: { # Information specific to cancellations initiated by Google system. # Subscription was canceled by the system, for example because of a billing problem.
    },
    &quot;userInitiatedCancellation&quot;: { # Information specific to cancellations initiated by users. # Subscription was canceled by user.
      &quot;cancelSurveyResult&quot;: { # Result of the cancel survey when the subscription was canceled by the user. # Information provided by the user when they complete the subscription cancellation flow (cancellation reason survey).
        &quot;reason&quot;: &quot;A String&quot;, # The reason the user selected in the cancel survey.
        &quot;reasonUserInput&quot;: &quot;A String&quot;, # Only set for CANCEL_SURVEY_REASON_OTHERS. This is the user&#x27;s freeform response to the survey.
      },
      &quot;cancelTime&quot;: &quot;A String&quot;, # The time at which the subscription was canceled by the user. The user might still have access to the subscription after this time. Use line_items.expiry_time to determine if a user still has access.
    },
  },
  &quot;externalAccountIdentifiers&quot;: { # User account identifier in the third-party service. # User account identifier in the third-party service.
    &quot;externalAccountId&quot;: &quot;A String&quot;, # User account identifier in the third-party service. Only present if account linking happened as part of the subscription purchase flow.
    &quot;obfuscatedExternalAccountId&quot;: &quot;A String&quot;, # An obfuscated version of the id that is uniquely associated with the user&#x27;s account in your app. Present for the following purchases: * If account linking happened as part of the subscription purchase flow. * It was specified using https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedaccountid when the purchase was made.
    &quot;obfuscatedExternalProfileId&quot;: &quot;A String&quot;, # An obfuscated version of the id that is uniquely associated with the user&#x27;s profile in your app. Only present if specified using https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid when the purchase was made.
  },
  &quot;kind&quot;: &quot;A String&quot;, # This kind represents a SubscriptionPurchaseV2 object in the androidpublisher service.
  &quot;latestOrderId&quot;: &quot;A String&quot;, # Deprecated: Use line_items.latest_successful_order_id instead. The order id of the latest order associated with the purchase of the subscription. For autoRenewing subscription, this is the order id of signup order if it is not renewed yet, or the last recurring order id (success, pending, or declined order). For prepaid subscription, this is the order id associated with the queried purchase token.
  &quot;lineItems&quot;: [ # Item-level info for a subscription purchase. The items in the same purchase should be either all with AutoRenewingPlan or all with PrepaidPlan.
    { # Item-level info for a subscription purchase.
      &quot;autoRenewingPlan&quot;: { # Information related to an auto renewing plan. # The item is auto renewing.
        &quot;autoRenewEnabled&quot;: True or False, # If the subscription is currently set to auto-renew, e.g. the user has not canceled the subscription
        &quot;installmentDetails&quot;: { # Information to a installment plan. # The installment plan commitment and state related info for the auto renewing plan.
          &quot;initialCommittedPaymentsCount&quot;: 42, # Total number of payments the user is initially committed for.
          &quot;pendingCancellation&quot;: { # This is an indicator of whether there is a pending cancellation on the virtual installment plan. The cancellation will happen only after the user finished all committed payments. # If present, this installment plan is pending to be canceled. The cancellation will happen only after the user finished all committed payments.
          },
          &quot;remainingCommittedPaymentsCount&quot;: 42, # Total number of committed payments remaining to be paid for in this renewal cycle.
          &quot;subsequentCommittedPaymentsCount&quot;: 42, # Total number of payments the user will be committed for after each commitment period. Empty means the installment plan will fall back to a normal auto-renew subscription after initial commitment.
        },
        &quot;priceChangeDetails&quot;: { # Price change related information of a subscription item. # The information of the last price change for the item since subscription signup.
          &quot;expectedNewPriceChargeTime&quot;: &quot;A String&quot;, # The renewal time at which the price change will become effective for the user. This is subject to change(to a future time) due to cases where the renewal time shifts like pause. This field is only populated if the price change has not taken effect.
          &quot;newPrice&quot;: { # Represents an amount of money with its currency type. # New recurring price for the subscription item.
            &quot;currencyCode&quot;: &quot;A String&quot;, # The three-letter currency code defined in ISO 4217.
            &quot;nanos&quot;: 42, # Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
            &quot;units&quot;: &quot;A String&quot;, # The whole units of the amount. For example if `currencyCode` is `&quot;USD&quot;`, then 1 unit is one US dollar.
          },
          &quot;priceChangeMode&quot;: &quot;A String&quot;, # Price change mode specifies how the subscription item price is changing.
          &quot;priceChangeState&quot;: &quot;A String&quot;, # State the price change is currently in.
        },
        &quot;priceStepUpConsentDetails&quot;: { # Information related to a price step-up that requires user consent. # The information of the latest price step-up consent.
          &quot;consentDeadlineTime&quot;: &quot;A String&quot;, # The deadline by which the user must provide consent. If consent is not provided by this time, the subscription will be canceled.
          &quot;newPrice&quot;: { # Represents an amount of money with its currency type. # The new price which requires user consent.
            &quot;currencyCode&quot;: &quot;A String&quot;, # The three-letter currency code defined in ISO 4217.
            &quot;nanos&quot;: 42, # Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
            &quot;units&quot;: &quot;A String&quot;, # The whole units of the amount. For example if `currencyCode` is `&quot;USD&quot;`, then 1 unit is one US dollar.
          },
          &quot;state&quot;: &quot;A String&quot;, # Output only. The state of the price step-up consent.
        },
        &quot;recurringPrice&quot;: { # Represents an amount of money with its currency type. # The current recurring price of the auto renewing plan. Note that the price does not take into account discounts and does not include taxes for tax-exclusive pricing, please call orders.get API instead if transaction details are needed.
          &quot;currencyCode&quot;: &quot;A String&quot;, # The three-letter currency code defined in ISO 4217.
          &quot;nanos&quot;: 42, # Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
          &quot;units&quot;: &quot;A String&quot;, # The whole units of the amount. For example if `currencyCode` is `&quot;USD&quot;`, then 1 unit is one US dollar.
        },
      },
      &quot;deferredItemRemoval&quot;: { # Information related to deferred item replacement. # Information for deferred item removal.
      },
      &quot;deferredItemReplacement&quot;: { # Information related to deferred item replacement. # Information for deferred item replacement.
        &quot;productId&quot;: &quot;A String&quot;, # The product_id going to replace the existing product_id.
      },
      &quot;expiryTime&quot;: &quot;A String&quot;, # Time at which the subscription expired or will expire unless the access is extended (ex. renews).
      &quot;latestSuccessfulOrderId&quot;: &quot;A String&quot;, # The order id of the latest successful order associated with this item. Not present if the item is not owned by the user yet (e.g. the item being deferred replaced to).
      &quot;offerDetails&quot;: { # Offer details information related to a purchase line item. # The offer details for this item.
        &quot;basePlanId&quot;: &quot;A String&quot;, # The base plan ID. Present for all base plan and offers.
        &quot;offerId&quot;: &quot;A String&quot;, # The offer ID. Only present for discounted offers.
        &quot;offerTags&quot;: [ # The latest offer tags associated with the offer. It includes tags inherited from the base plan.
          &quot;A String&quot;,
        ],
      },
      &quot;prepaidPlan&quot;: { # Information related to a prepaid plan. # The item is prepaid.
        &quot;allowExtendAfterTime&quot;: &quot;A String&quot;, # If present, this is the time after which top up purchases are allowed for the prepaid plan. Will not be present for expired prepaid plans.
      },
      &quot;productId&quot;: &quot;A String&quot;, # The purchased product ID (for example, &#x27;monthly001&#x27;).
      &quot;signupPromotion&quot;: { # The promotion applied on this item when purchased. # Promotion details about this item. Only set if a promotion was applied during signup.
        &quot;oneTimeCode&quot;: { # A single use promotion code. # A one-time code was applied.
        },
        &quot;vanityCode&quot;: { # A multiple use, predefined promotion code. # A vanity code was applied.
          &quot;promotionCode&quot;: &quot;A String&quot;, # The promotion code.
        },
      },
    },
  ],
  &quot;linkedPurchaseToken&quot;: &quot;A String&quot;, # The purchase token of the old subscription if this subscription is one of the following: * Re-signup of a canceled but non-lapsed subscription * Upgrade/downgrade from a previous subscription. * Convert from prepaid to auto renewing subscription. * Convert from an auto renewing subscription to prepaid. * Topup a prepaid subscription.
  &quot;pausedStateContext&quot;: { # Information specific to a subscription in paused state. # Additional context around paused subscriptions. Only present if the subscription currently has subscription_state SUBSCRIPTION_STATE_PAUSED.
    &quot;autoResumeTime&quot;: &quot;A String&quot;, # Time at which the subscription will be automatically resumed.
  },
  &quot;regionCode&quot;: &quot;A String&quot;, # ISO 3166-1 alpha-2 billing country/region code of the user at the time the subscription was granted.
  &quot;startTime&quot;: &quot;A String&quot;, # Time at which the subscription was granted. Not set for pending subscriptions (subscription was created but awaiting payment during signup).
  &quot;subscribeWithGoogleInfo&quot;: { # Information associated with purchases made with &#x27;Subscribe with Google&#x27;. # User profile associated with purchases made with &#x27;Subscribe with Google&#x27;.
    &quot;emailAddress&quot;: &quot;A String&quot;, # The email address of the user when the subscription was purchased.
    &quot;familyName&quot;: &quot;A String&quot;, # The family name of the user when the subscription was purchased.
    &quot;givenName&quot;: &quot;A String&quot;, # The given name of the user when the subscription was purchased.
    &quot;profileId&quot;: &quot;A String&quot;, # The Google profile id of the user when the subscription was purchased.
    &quot;profileName&quot;: &quot;A String&quot;, # The profile name of the user when the subscription was purchased.
  },
  &quot;subscriptionState&quot;: &quot;A String&quot;, # The current state of the subscription.
  &quot;testPurchase&quot;: { # Whether this subscription purchase is a test purchase. # Only present if this subscription purchase is a test purchase.
  },
}</pre>
</div>

<div class="method">
    <code class="details" id="revoke">revoke(packageName, token, body=None, x__xgafv=None)</code>
  <pre>Revoke a subscription purchase for the user.

Args:
  packageName: string, Required. The package of the application for which this subscription was purchased (for example, &#x27;com.some.thing&#x27;). (required)
  token: string, Required. The token provided to the user&#x27;s device when the subscription was purchased. (required)
  body: object, The request body.
    The object takes the form of:

{ # Request for the purchases.subscriptionsv2.revoke API.
  &quot;revocationContext&quot;: { # Revocation context of the purchases.subscriptionsv2.revoke API. # Required. Additional details around the subscription revocation.
    &quot;fullRefund&quot;: { # Used to determine if the refund type in the RevocationContext is a full refund. # Optional. Used when users should be refunded the full amount of latest charge on each item in the subscription.
    },
    &quot;itemBasedRefund&quot;: { # Used to determine what specific item to revoke in a subscription with multiple items. # Optional. Used when a specific item should be refunded in a subscription with add-on items.
      &quot;productId&quot;: &quot;A String&quot;, # Required. If the subscription is a subscription with add-ons, the product id of the subscription item to revoke.
    },
    &quot;proratedRefund&quot;: { # Used to determine if the refund type in the RevocationContext is a prorated refund. # Optional. Used when users should be refunded a prorated amount they paid for their subscription based on the amount of time remaining in a subscription.
    },
  },
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response for the purchases.subscriptionsv2.revoke API.
}</pre>
</div>

</body></html>